<?php

namespace App\Repositories\Transformers;

use App\Models\VolunteerActivity;
use League\Fractal\TransformerAbstract;

class VolunteerActivityListTransformer extends TransformerAbstract
{
    public function transform(VolunteerActivity $volunteerActivity)
    {

        return [
            'id' => $volunteerActivity->id,
            'title' => $volunteerActivity->title,
            'image' => $volunteerActivity->image,
            'activity_time_start' => $volunteerActivity->activity_time_start,
            'activity_time_end' => $volunteerActivity->activity_time_end,
            'limit_count' => $volunteerActivity->limit_count,
            'volunteer_form_count' => $volunteerActivity->volunteer_form_count ?? 0,
            'created_at' => $volunteerActivity->created_at != null ? $volunteerActivity->created_at->toDateTimeString() : null,
        ];
    }
}
